package net.bolue.sysmng.tblbean;

import java.util.Iterator;
import java.util.Map;
import java.util.Set;


/**
 * 新增资源
 * @author Administrator
 *
 */
public class InsRes extends TableBean{

	/**
	 * 子系统
	 */
	private String subSys;
	
	/**
	 * 新增标识
	 */
	private String insertId;
	
	/**
	 * 新增类型
	 * 1,直接数据表操作
	 * 2，数据表映射类操作
	 * 3,批量直接数据表操作
	 * 4,批量表映射类操作
	 */
	private Integer insType;
	
	/**
	 * 描述
	 */
	private String resDesc;
	
	/**
	 * 新增对象
	 */
	private String resObj;
	
	/**
	 * 插入列
	 */
	private String insCols;
	
	/**
	 * 只显示列集
	 */
	private String dispCols;
	
	/**
	 * 排列格式
	 */
	private String arrayFmt;
	
	/**
	 * 业务层新增类名
	 */
	private String busiClass;
	
	/**
	 * 业务层新增方法
	 */
	private String busiMethod;
	
	/**
	 * 备注
	 */
	private String remark;

	public String getSubSys() {
		return subSys;
	}

	public void setSubSys(String subSys) {
		this.subSys = subSys;
	}

	public String getInsertId() {
		return insertId;
	}

	public void setInsertId(String insertId) {
		this.insertId = insertId;
	}
	
	public Integer getInsType() {
		return insType;
	}

	public void setInsType(Integer insType) {
		this.insType = insType;
	}

	public String getResDesc() {
		return resDesc;
	}

	public void setResDesc(String resDesc) {
		this.resDesc = resDesc;
	}

	public String getResObj() {
		return resObj;
	}

	public void setResObj(String resObj) {
		this.resObj = resObj;
	}

	public String getInsCols() {
		return insCols;
	}

	public void setInsCols(String insCols) {
		this.insCols = insCols;
	}

	public String getDispCols() {
		return dispCols;
	}

	public void setDispCols(String dispCols) {
		this.dispCols = dispCols;
	}

	public String getArrayFmt() {
		return arrayFmt;
	}

	public void setArrayFmt(String arrayFmt) {
		this.arrayFmt = arrayFmt;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getBusiClass() {
		return busiClass;
	}

	public void setBusiClass(String busiClass) {
		this.busiClass = busiClass;
	}

	public String getBusiMethod() {
		return busiMethod;
	}

	public void setBusiMethod(String busiMethod) {
		this.busiMethod = busiMethod;
	}

	@Override
	public InsRes mapToEntry(Map<String, Object> map) {
		InsRes insRes = new InsRes();
		Set<String> keySet = map.keySet();
		Iterator<String> keyIt = keySet.iterator();
		while(keyIt.hasNext()){
			String key = keyIt.next();
			Object o = map.get(key);
			if("SUBSYS".equals(key)){
				insRes.setSubSys((String)o);
			} else if("INSERTID".equals(key)){
				insRes.setInsertId((String)o);
			} else if("INSTYPE".equals(key)){
				insRes.setInsType((Integer)o);
			} else if("RESDESC".equals(key)){
				insRes.setResDesc((String)o);
			} else if("RESOBJ".equals(key)){
				insRes.setResObj((String)o);
			} else if("INSCOLS".equals(key)){
				insRes.setInsCols((String)o);
			} else if("DISPCOLS".equals(key)){
				insRes.setDispCols((String)o);
			} else if("ARRAYFMT".equals(key)){
				insRes.setArrayFmt((String)o);
			} else if("BUSICLASS".equals(key)){
				insRes.setBusiClass((String)o);
			} else if("BUSIMETHOD".equals(key)){
				insRes.setBusiMethod((String)o);
			} else if("REMARK".equals(key)){
				insRes.setRemark((String)o);
			}
		}
		return insRes;
	}

	@Override
	public String keyProps() {
		return "SUBSYS,INSERTID";
	}
	
	public String getTableName(){
		String tableName = "";
		if(this.insType==1||this.insType==3){
			tableName = this.resObj;
		}
		return tableName;
	}
	
}
